package com.xcx.portal.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.xcx.common.services.MosquitoService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 驱蚊controller
 *
 * @author tangqy
 * @date 2018年07月23日11:10:48
 */
@RestController
@RequestMapping(value = "/xcx/mosquito")
public class MosquitoController {

    @Reference
    private MosquitoService mosquitoService;


    /**
     * 用户登录
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/userLogin", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String userLogin(@RequestBody String reqStr) {
        return mosquitoService.userLogin(reqStr);
    }


    /**
     * 保存用户信息
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/saveUserInfo", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String saveUserInfo(@RequestBody String reqStr) {
        return mosquitoService.saveUserInfo(reqStr);
    }


    /**
     * 保存用户使用时间 及返回是否超时
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/saveUserTime", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String saveUseTime(@RequestBody String reqStr) {
        return mosquitoService.recordUseTime(reqStr);
    }

    /**
     * 查询用户是否解锁
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserUnlock", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserUnlock(@RequestBody String reqStr) {
        return mosquitoService.queryUserUnlock(reqStr);
    }

    /**
     * 保存更新用户分享次数
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/updateUserShare", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String updateUserShare(@RequestBody String reqStr) {
        return mosquitoService.updateUserShare(reqStr);
    }

    /**
     * 查询分享图片列表
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/querySharePhoto", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String querySharePhoto(@RequestBody String reqStr) {
        return mosquitoService.querySharePhoto(reqStr);
    }


}
